package comm;

public class Message {

	public static final byte COMM_MSG_DONOTHING = 0;
	public static final byte COMM_MSG_REJECTED = 1;
	public static final byte COMM_MSG_ACCEPT = 2;
	public static final byte COMM_MSG_FIRST = 3;
	public static final byte COMM_MSG_SECOND = 4;
	public static final byte COMM_MSG_GAME_REQUIRE_START = 5;
	public static final byte COMM_MSG_GAME_START = 6;
	public static final byte COMM_MSG_CHESS = 7;
	public static final byte COMM_MSG_TIMEOUT = 8;
	public static final byte COMM_MSG_WIN = 9;
	public static final byte COMM_MSG_LOSE = 10;
	public static final byte COMM_MSG_DRAW = 11;

	public byte msg;

	public Message(byte m) {
		msg = m;
	}

	public String getMsgType() {
		switch (msg) {
		case COMM_MSG_DONOTHING:
			return "COMM_MSG_DONOTHING";
		case COMM_MSG_REJECTED:
			return "COMM_MSG_REJECTED";
		case COMM_MSG_ACCEPT:
			return "COMM_MSG_ACCEPT";
		case COMM_MSG_FIRST:
			return "COMM_MSG_FIRST";
		case COMM_MSG_SECOND:
			return "COMM_MSG_SECOND";
		case COMM_MSG_GAME_REQUIRE_START:
			return "COMM_MSG_GAME_REQUIRE_START";
		case COMM_MSG_GAME_START:
			return "COMM_MSG_GAMESTART";
		case COMM_MSG_CHESS:
			return "COMM_MSG_CHESS";
		case COMM_MSG_TIMEOUT:
			return "COMM_MSG_TIMEOUT";
		case COMM_MSG_WIN:
			return "COMM_MSG_WIN";
		case COMM_MSG_LOSE:
			return "COMM_MSG_LOSE";
		case COMM_MSG_DRAW:
			return "COMM_MSG_DRAW";
		}
		return "MSG_ERR";
	}
}
